feat(billing): Add seats info to payment attempts page#8527
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 454faa6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughThis PR introduces seat-based billing totals to payment attempts across the stack. It starts by defining the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/src/components/PaymentAttempts/PaymentAttemptPage.tsx`:
- Around line 232-243: The seats description currently always renders a
quantity×rate string; update the JSX in the PaymentAttemptPage component so that
when seatSummary.paidTier.quantity === null (an unlimited paid tier) you do not
render the "× {feePerBlock}" piece and instead only show the tier total,
otherwise keep the existing "{used} × {feePerBlock}" behavior; specifically
adjust the LineItems.Title description expression (using seatSummary,
seatSummary.paidTier.quantity, seatSummary.paidTier.feePerBlock and
seatSummary.paidTier.total) to branch on paidTier.quantity and produce the
appropriate string for unlimited vs. limited tiers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 1cd96259-918b-49c3-9ce0-6aa6a4195339
📒 Files selected for processing (9)
.changeset/billing-seat-tier-rows-payment-attempt.mdpackages/clerk-js/src/core/resources/BillingPayment.tspackages/clerk-js/src/utils/__tests__/billing.test.tspackages/clerk-js/src/utils/billing.tspackages/shared/src/types/billing.tspackages/shared/src/types/json.tspackages/ui/src/components/PaymentAttempts/PaymentAttemptPage.tsxpackages/ui/src/utils/__tests__/billingPlanSeats.test.tspackages/ui/src/utils/billingPlanSeats.ts
| {seatSummary && ( | ||
| <LineItems.Group variant='tertiary'> | ||
| <LineItems.Title | ||
| title={localizationKeys('billing.seats')} | ||
| description={`${seatSummary.used} ${seatSummary.used === 1 ? 'seat' : 'seats'}${ | ||
| seatSummary.included > 0 ? ` (${seatSummary.included} included)` : '' | ||
| } × ${seatSummary.paidTier.feePerBlock.currencySymbol}${seatSummary.paidTier.feePerBlock.amountFormatted}`} | ||
| /> | ||
| <LineItems.Description | ||
| text={`${seatSummary.paidTier.total.currencySymbol}${seatSummary.paidTier.total.amountFormatted}`} | ||
| /> | ||
| </LineItems.Group> |
There was a problem hiding this comment.
Handle unlimited paid tiers without quantity×rate text
The seats description always renders "{used} × {feePerBlock}". For unlimited paid tiers (paidTier.quantity === null), this is incorrect/misleading and conflicts with the intended “show tier total for unlimited tiers” behavior.
Proposed fix
{seatSummary && (
<LineItems.Group variant='tertiary'>
<LineItems.Title
title={localizationKeys('billing.seats')}
- description={`${seatSummary.used} ${seatSummary.used === 1 ? 'seat' : 'seats'}${
- seatSummary.included > 0 ? ` (${seatSummary.included} included)` : ''
- } × ${seatSummary.paidTier.feePerBlock.currencySymbol}${seatSummary.paidTier.feePerBlock.amountFormatted}`}
+ description={
+ seatSummary.paidTier.quantity === null
+ ? undefined
+ : `${seatSummary.used} ${seatSummary.used === 1 ? 'seat' : 'seats'}${
+ seatSummary.included > 0 ? ` (${seatSummary.included} included)` : ''
+ } × ${seatSummary.paidTier.feePerBlock.currencySymbol}${seatSummary.paidTier.feePerBlock.amountFormatted}`
+ }
/>
<LineItems.Description
text={`${seatSummary.paidTier.total.currencySymbol}${seatSummary.paidTier.total.amountFormatted}`}
/>
</LineItems.Group>
)}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ui/src/components/PaymentAttempts/PaymentAttemptPage.tsx` around
lines 232 - 243, The seats description currently always renders a quantity×rate
string; update the JSX in the PaymentAttemptPage component so that when
seatSummary.paidTier.quantity === null (an unlimited paid tier) you do not
render the "× {feePerBlock}" piece and instead only show the tier total,
otherwise keep the existing "{used} × {feePerBlock}" behavior; specifically
adjust the LineItems.Title description expression (using seatSummary,
seatSummary.paidTier.quantity, seatSummary.paidTier.feePerBlock and
seatSummary.paidTier.total) to branch on paidTier.quantity and produce the
appropriate string for unlimited vs. limited tiers.
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Adds seat info to payment attempts page